using System;
using Entitas;
using UnityEngine;

public class GameController : MonoBehaviour
{
    private Systems _systems;

    private void Awake()
    {
        var contexts = Contexts.sharedInstance;
        _systems = GetSystems(contexts);

        new Services(contexts, transform);
        _systems.Initialize();
    }

    void Update()
    {
        _systems.Execute();
        _systems.Cleanup();
    }

    private Systems GetSystems(Contexts contexts)
    {
        return new GameFeature(contexts)
            .Add(new GameEventSystems(contexts))
            .Add(new InputFeature(contexts));
    }
}